﻿using GN.Pay.TradeChannel.Configure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.AliPay
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class AliPayConfigure : ATradeChannelConfigure<AiliPayConfigureInfo>
    {
        public AliPayConfigure(IChannel channel)
            : base(channel)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        protected override string NotifyControllerName
        {
            get
            {
                return "AliPay";
            }
        }

        public override string GetOrderQueryErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        public override string GetPayErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        public override string GetRefundErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 获取网关Url
        /// </summary>
        public string GateWayUrl
        {
            get
            {
                return "https://mapi.alipay.com/gateway.do";
            }
        }

        /// <summary>
        /// 获取网关Url
        /// </summary>
        public string OpenApiGateWayUrl
        {
            get
            {
                return "https://openapi.alipay.com/gateway.do";
            }
        }

        protected override void SaveCheck(AiliPayConfigureInfo configureInfo)
        {
            this.CheckNotNull(configureInfo, nameof(configureInfo));
            this.CheckNotNullOrWhite(configureInfo.PrivateKey, nameof(configureInfo.PrivateKey));
            this.CheckNotNullOrWhite(configureInfo.PublicKey, nameof(configureInfo.PublicKey));
            this.CheckNotNullOrWhite(configureInfo.AccountId, nameof(configureInfo.AccountId));
            this.CheckNotNullOrWhite(configureInfo.SellerEmail, nameof(configureInfo.SellerEmail));
            this.CheckNotNullOrWhite(configureInfo.AppId, nameof(configureInfo.AppId));
        }
    }
}
